<?php

require_once '../include/common.inc.php';
require_once '../include/error_code.php';
include_once '../include/cart.class_p.php';

if (!checkAdmin()) {
   header("LOCATION:index.php");
  exit;
}
$menu_index = 2;
$page_title = 'TABLA';
$guide_message = 'Customer | Order Information | Promoter | Edit';


getMyParam('cid');
$sql="select * from promoter_order where id=$cid";
$query = $db->query($sql);
$order_ary = $db->fetch_array($query);

/////////////////////////////////////////////////////////get cart information/////////////
$cart_info=unserialize($order_ary['cart_info']);
if(empty($cart_info) || $cart_info=="")
   $cart_info=new cart();
   
//var_dump($cart_info);
$cart_info->update();
$my_cart=$cart_info->myCart;

$totalCost=$cart_info->getTotalCost();
$discount=$cart_info->getDisCount();
$new_total=$totalCost-$discount;
$vat_fee=$cart_info->getAddVat();
$addshippingfee=$cart_info->getAddShippingFee();
$totalCost2=$cart_info->getTotalCost2();

$proTotalCost=$cart_info->getProTotalCost();
$margin=$totalCost-$discount-$proTotalCost;

$promoter_id=$cart_info->promoter_id;

////////////////////////////////////////////////

//Promoter Details
$sql="select * from promoter_info where id=".$order_ary['promoter_id'];
$query = $db->query($sql);
$promoter_ary = $db->fetch_array($query);
//Other Info
if($order_ary['card_type']=="V-DK")$order_ary['card_type']="<img src='../images/card01.gif' width='31' height='21'>";
if($order_ary['card_type']=="MC(DK)")$order_ary['card_type']="<img src='../images/card02.gif' width='31' height='21'>";
if($order_ary['card_type']=="DK")$order_ary['card_type']="<img src='../images/card03.gif' width='31' height='21'>";
$order_ary['card_number']=substr($order_ary['card_number'], -4); 

$cur_deliver_status=$order_ary['deliver_status'];//--leo,current deliver status
$pay_flag=$order_ary['pay_flag'];
if($pay_flag==0)
{
if($order_ary['deliver_status']==0) $order_ary['deliver_status']="<input type='radio' name='deliver_status' value='0' checked='checked' >Non-deliver<input type='radio' name='deliver_status' value='1' >Delivered<input type='radio' name='deliver_status' value='2' >Cancelled";
if($order_ary['deliver_status']==1) $order_ary['deliver_status']="<input type='radio' name='deliver_status' value='0' >Non-deliver<input type='radio' name='deliver_status' value='1' checked='checked' >Delivered <input type='radio' name='deliver_status' value='2'>Cancelled";
if($order_ary['deliver_status']==2) $order_ary['deliver_status']="<input type='radio' name='deliver_status' value='0' >Non-deliver<input type='radio' name='deliver_status' value='1' >Delivered<input type='radio' name='deliver_status' value='2' checked='checked' >Cancelled";
}
else
{
	$order_ary['deliver_status']="Aborted";
}



if($customer_ary['faq1']==1)$customer_ary['faq1']="Yes";
else $customer_ary['faq1']="No";

if($customer_ary['faq2']==1)$customer_ary['faq2']="Yes";
else $customer_ary['faq2']="No";

//Response
$error_msg=$error_ary[$order_ary['pay_flag']];

include_once('menu_list.php');
require_once PrintEot('a_header');
require_once PrintEot('a_c_order_p_edit');
require_once PrintEot('a_footer');

?>